<?php 
import('@.Model.CommonModel');
class ArticleModel extends CommonModel 
{
	// 验证信息、自动填充信息、关联信息定义 
	protected $_validate	 =	 array(
		array('pcid','require','关联产品必须！'),
		array('title','require','标题必须！'),
		array('content','require','内容必须'),
		array('verify','require','验证码必须！'),
		array('verify','CheckVerify','验证码错误',0,'callback'),
		);

	protected $_auto	 =	 array(
		array('status','1','ADD'),
		array('addtime','time','ADD','function'),
		);

	protected $blobFields = array('content');

	//digg
	function digg($ids,$status='1') {
		if($status=='1'){
			$result = $this->setField('digup',' digup+1 ',"cid in ($ids)");
			$result = $this->setField('dignum',' dignum+1 ',"cid in ($ids)");
			return true;
		}else($status=='0'){
			$result = $this->setField('digdown',' digdown+1 ',"cid in ($ids)");
			$result = $this->setField('dignum',' dignum-1 ',"cid in ($ids)");
			return true;
		}else{
			return false;
		}
	}
}
?>